﻿namespace MvcXRepairAdmin.CacheData
{
    using System.Collections.Generic;
    using System.Linq;
    using MvcXRepairAdmin.Interfaces;
    using MvcXRepairAdmin.Services;
    using XRepair.Models;
    using System;

    public class Cache
    {
        private static ISymptomService symptomService;
        private static IBrandService brandService;
        private static IModelService modelService;
        private static IOrderService orderService;
        private static IServiceService serviceService;
        private static ICityService cityService;
        private static IStateService stateService;
        private static IUserService userService;
        private static IOrderStatusService orderStatusService;

        public static List<Symptom> GetAllActiveSymptoms()
        {
            symptomService = new SymptomService();
            try
            {
                return symptomService.GetAllActiveSymptoms().ToList();
            }
            catch (Exception)
            {
                return new List<Symptom>();
            }

            //return symptomService.GetAllActiveSymptoms().ToList();
        }

        public static List<Brand> GetAllActiveBrands()
        {
            brandService = new BrandService();
            try
            {
                return brandService.GetAllActiveBrands().ToList();
            }
            catch(Exception)
            {
                return new List<Brand>(); 
            }

            //return brandService.GetAllActiveBrands().ToList();
        }

        public static List<Model> GetAllActiveModels()
        {
            modelService = new ModelService();
            try
            {
                return modelService.GetAllActiveModels().ToList();
            }
            catch (Exception)
            {
                return new List<Model>();
            }

            //return modelService.GetAllActiveModels().ToList();
        }

        public static List<Order> GetAllActiveOrders()
        {
            orderService = new OrderService();
            try
            {
                return orderService.GetAllActiveOrders().ToList();
            }
            catch (Exception)
            {
                return new List<Order>();
            }
        }

        public static List<Service> GetAllActiveServices()
        {
            serviceService = new ServiceService();
            try
            {
                return serviceService.GetAllActiveServices().ToList();
            }
            catch (Exception)
            {
                return new List<Service>();
            }
        }

        public static List<City> GetAllActiveCities()
        {
            cityService = new CityService();
            try
            {
                return cityService.GetAllActiveCities().ToList();
            }
            catch (Exception)
            {
                return new List<City>();
            }
        }

        public static List<State> GetAllActiveStates()
        {
            stateService = new StateService();
            try
            {
                return stateService.GetAllActiveStates().ToList();
            }
            catch (Exception)
            {
                return new List<State>();
            }
        }

        public static List<User> GetAllActiveUsers()
        {
            userService = new UserService();
            try
            {
                return userService.GetAllActiveUsers().ToList();
            }
            catch (Exception)
            {
                return new List<User>();
            }
        }


        public static List<OrderStatus> GetAllOrderStatus()
        {
            orderStatusService = new OrderStatusService();
            try
            {
                return orderStatusService.GetAllOrderStatus().ToList();
            }
            catch (Exception)
            {
                return new List<OrderStatus>();
            }
        }
    }
}
